#coding:utf-8;
import os

#读文件夹列表
list1 = [".exe",".class"]

def readDirListAndRemoveFile(path):
    files = os.listdir()
    s = []
    for file in files:
        if not os.path.isdir(file):
            if os.path.splitext(path + "\\" + file)[-1] in list1:
                s.append(file)
                os.remove(file)
    return s

if __name__ == "__main__":
    path = os.getcwd()
    for i in readDirListAndRemoveFile(path):
        print("已经删除-->" + i)
